import { S } from '../../s';
import { IPSAppDEDataSet } from '../../app/dataentity/ipsapp-dedata-set';
import { IPSAppDataEntity } from '../../app/dataentity/ipsapp-data-entity';
import { IPSDEChartDataSetGroup } from './ipsdechart-data-set-group';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSDEChartDataSetGroupImpl
  extends PSModelObjectImpl
  implements IPSDEChartDataSetGroup
{
  get index(): number {
    return this.M.index;
  }

  protected psappdedataset: IPSAppDEDataSet;
  getPSAppDEDataSet(): IPSAppDEDataSet | null {
    if (this.psappdedataset != null) return this.psappdedataset;
    const value = this.M.getPSAppDEDataSet;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.psappdedataset = ipsappdataentity.findPSAppDEDataSet(value);
    }
    return this.psappdedataset;
  }

  protected psappdataentity: IPSAppDataEntity;
  getPSAppDataEntity(): IPSAppDataEntity | null {
    return (
      this.psappdataentity ||
      (this.psappdataentity = this.fillObjectModel(
        S._f,
        this.M.getPSAppDataEntity,
        S._2aa,
      ) as IPSAppDataEntity)
    );
  }
  get cls(): string {
    return 'PSDEChartDataSetGroupImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._f0 || cls == S._f1) return true;
    return super.instanceof(cls);
  }
}
